/***************************************************************************
 *   Copyright (C) 2009 by mj   *
 *   mj_dv@web.de   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

// main.cpp is a part of the steamserverutil project it is the GUI using Qt 4 for the console app steamserverutil
// steamserverutil.googlecode.com

//Version: svn0.1a

#include <QSettings>
#include <QTranslator>
#include <QtGui/QApplication>

#include "ssu_gui.h"
#include "firststart.h"

int main(int argc, char *argv[])
{

    QSettings settings("MJ", "ssu_gui");

    QString lang = settings.value("lang", "default").toString();
    QApplication a(argc, argv);

    QTranslator translator;
    QTranslator qtTranslator;

    qtTranslator.load("qt" + QLocale::system().name(), ":/");

    if(lang == "default")
    {
        translator.load("ssu_gui_" + QLocale::system().name(), ":/");
    }
    else
    {
        if(lang == "Deutsch")
            translator.load(":/lang/ssu_gui_de");

    }

    a.installTranslator(&translator);
    a.installTranslator(&qtTranslator);

    steamserverutil *util = new steamserverutil();
    QString wdir = util->workdir.c_str();
    if(wdir == "nodir")
    {
        firstStart *fs = new firstStart();
        if(fs->exec() == QDialog::Rejected)
            return 0;


        delete fs;
        util->get_workspace();
    }

    ssu_gui w;
    w.show();
    return a.exec();
}
